home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza - Disc 1 / ShareWare Extravaganza 1 of 4 (The Ultimate Shareware Company).iso / grprogs / piclab.exe / PICLAB.DOC next >
Text File  |  1989-06-23  |  40KB  |  839 lines

  1. PICLAB.DOC
  2.  
  3. Overview
  4. ========
  5.  
  6. This document describes the PICLAB 1.0 image processing system.  This program
  7. is the first (and only) free public release of this system.  There will be
  8. future commercial version with more features and a better interface at some
  9. later time, but this version will remain the only free one.  Please feel free
  10. to distribute PICLAB any way you like, but include this document with it.
  11.  
  12. PICLAB is a program for performing mathematical transformations on images
  13. in various formats.  It is intended to work with true-color rather than
  14. color-mapped images.  That is, it deals with images with no restrictions on
  15. the total number of colors in the image.  Each pixel stores complete RGB
  16. values without reference to any external palette.
  17.  
  18. PICLAB is not designed as a "Paint" program.  Its screen display commands are
  19. primitive (in fact only added as an afterthought), but its hardcopy printing
  20. to HP LaserJet and PaintJet is very powerful (although slow).
  21.  
  22. This bears repeating: PICLAB IS NOT DESIGNED FOR SCREEN DISPLAYS.  The
  23. limited screen display capabilties provided by its SHOW command are only used 
  24. to support its major functions, which are mathmatical enhancement of images
  25. and printing.  Image data is kept completely independent of the devices on
  26. which the images are rendered.  This assures that an image can always be
  27. rendered to the best of its ability on any device, regardless of the
  28. limitations of the devices it has been on in the past.
  29.  
  30. Because PICLAB currently does not support any devices that can display
  31. images as accurately as PICLAB stores them, you can never really "see" an
  32. image exactly as it is stored.  There are devices this accurate--TrueVision's
  33. Targa 24 board is a popular one--and support for displays like these will
  34. probably be a major part of the enhanced program.  For now, just keep in
  35. mind that what you see on the screen with the "SHOW" command is only a rough
  36. approximation of the real image.
  37.  
  38. My name and address appears at the end of this document, as well as my
  39. CompuServe ID.  Either is a good way to contact me.
  40.  
  41.  
  42. General Operation
  43. =================
  44.  
  45. After starting PICLAB by typing "PL" at the system command line, the user may
  46. enter any of a number of commands, each of which is performed immediately.
  47. While commands can be taken from a file, PICLAB is not (yet) intended to be a
  48. programming language.  It is an interpreter of the slowest kind, and no
  49. provisions are made for looping constructs or conditional tests.
  50.  
  51. If an argument is given to the PL command, it is taken as the name of a file
  52. containing PICLAB commands.  This feature can be used to set the PICLAB
  53. variables to settings appropriate for your environment, or for performing
  54. tasks in batch files.  In the latter case, the program specified should have
  55. an EXIT command so that PICLAB will return control to the batch file after the
  56. program is complete.
  57.  
  58. Commands generally operate on two internal picture buffers called OLD and
  59. NEW.  Most commands start by deleting OLD and renaming NEW to OLD.  They then
  60. perform some transformation on OLD storing the result in NEW.  The command
  61. UNDO swaps NEW and OLD--effectively reversing the last operation.
  62.  
  63. OLD and NEW are stored on disk.  This decision was made primarily because my
  64. taste in pictures is better than my budget for RAM.  If you are dealing with
  65. simpler pictures, or if you have RAM to burn, you can direct PICLAB to store
  66. OLD and NEW on a RAMdisk.  In MSDOS and similar operating systems, this is
  67. done by typing "SET TMP=D:" at the system command line before running PICLAB,
  68. where D: is the drive or directory specification of the RAMdisk.
  69.  
  70. PICLAB can read and write images in different file formats.  The LOAD command
  71. is used to read an image in one of these formats into the edit buffers.  The
  72. SAVE is used to write the contents of the edit buffers into one of these
  73. formats.  Every session with PICLAB will generally begin with a LOAD, and end
  74. with a SAVE (or perhaps a PRINT) with some processing in between.  A file may
  75. be loaded from one file format and saved in a different one, thereby
  76. converting among formats.
  77.  
  78. Command parsing in PICLAB is roughly like that of the system command line.
  79. The line is broken into words that must be separated by spaces; the first
  80. word specifies the actual command and the remaining words are passed to the
  81. command handler as arguments.  The individual command-handling routines are
  82. responsible for interpreting their arguments.  Generally, a word may be
  83. shortened as long as it does not conflict with any other word in the same
  84. context. For example, the LIST COMMANDS command may be abbreviated LIS COM.
  85.  
  86.  
  87. Miscellaneous commands
  88. ======================
  89.  
  90. These are all of the commands that do not fit into one of the categories
  91. listed later.  They are, however, the commands that you will use the most--
  92. so I have listed them first.
  93.  
  94. CALL
  95.  
  96.     This command calls the external program named by its first argument
  97.     passing along any subsequent arguments to that program.  Many programs do
  98.     not release all of the memory given to them when they terminate, so
  99.     PICLAB will reserve a large portion of memory for itself before calling a
  100.     program.  If you do not have much more memory than PICLAB reserves, this
  101.     may result in the program not being able to run in the memory left.
  102.  
  103.     If this is a problem, you can use the DOS or SHELL commands (described
  104.     below) to exit to DOS with all of the free memory available.
  105.  
  106.     The amount of memory reserved by PICLAB in this way can only be changed
  107.     by recompiling the source code with the variable "minalloc" set to a
  108.     different value.  It is not recommended that you do this.  The amount of
  109.     memory reserved is sufficient to save the image in the edit buffer so
  110.     that you can restart PICLAB if necessary without losing it.
  111.  
  112. CANCEL
  113. UNDO
  114.  
  115.     These are aliases for the same command, which cancels the most recent
  116.     operation.  If there are point transformations pending that have not yet
  117.     been saved with the TRANSFORM command, these are cancelled and no changes
  118.     are made to the edit buffers.  Otherwise, the NEW and OLD buffers are
  119.     exchanged.
  120.  
  121.     There are some operations (like SAVE) that do not alter the edit buffers.
  122.     If one of these operations was the last one performed, UNDO will undo
  123.     the operation before that.  There are no arguments to this command.
  124.  
  125. DOS
  126. SHELL
  127.  
  128.     These are also aliases for the same command, which in this case calls up
  129.     the DOS command line.  All available memory is released to DOS when this
  130.     command is given, and is reclaimed when DOS is exited.  For this reason,
  131.     some programs that cannot be CALLed may be run from with DOS.
  132.  
  133.     Any arguments to this command will be passed to the system as a command
  134.     line, and will cause it to return immediately after the command is done.
  135.     One particularly useful action of this program is "DOS COPY /B PDAT PRN",
  136.     which copies the print file to the printer.  "DOS DIR" can be used to view
  137.     file directories when you want to see all files, not just pictures.
  138.  
  139. EXIT
  140. QUIT
  141.  
  142.     Aliases for the same command, which exits PICLAB.  If there is a point
  143.     transformation pending, it must be cancelled or saved before exiting.  If
  144.     the exit command is given any arguments, it exits immediately regardless
  145.     of pending transformations.
  146.  
  147.     Inside a program, exit merely sets a flag so that PICLAB will exit after
  148.     the program is complete.
  149.  
  150. LIST
  151.  
  152.     If given without an argument, lists all things that can be listed.  If
  153.     one of these things (e.g. FORMATS, COMMANDS, BUFFERS) is given as an
  154.     argument, the appropriate items are listed.  Especially useful are LIST
  155.     COMMANDS if you forget the name of a command you are looking for and LIST
  156.     BUFFERS to check the size and format of the image in the OLD and NEW edit
  157.     buffers.
  158.  
  159. PAUSE
  160.  
  161.     This is primarily for use within programs.  With no arguments, PICLAB
  162.     waits for a key to be pressed before continuing.  If one argument is
  163.     given, PICLAB waits for that number of seconds (but will break early
  164.     if a key is pressed).
  165.  
  166. PRINT
  167.  
  168.     This prints the image in the NEW buffer into the file specified by the
  169.     PRINTFILE variable.  The current setting of the PRINTER variable
  170.     determines what codes are sent to the file.  The file (which defaults to
  171.     the name PDAT) can be copied to the printer immediately by issuing the
  172.     DOS COPY /B PDAT PRN command, or can be saved for later printing.
  173.  
  174.     If the PRINTER variable is set to LASERJET, the DPI variable is used to
  175.     determine which graphics resolution to use.  In any case, each pixel in
  176.     the image will become four dots (2 x 2) on the LaserJet.  For example, a
  177.     320x200 image printed to the LaserJet at 150 DPI will come out to about
  178.     4 1/4 inches wide.
  179.  
  180.     If PRINTER is set to PAINTJET, color images will be printed at 90 DPI and
  181.     monochrome images at 180 DPI.
  182.  
  183.     For hard-to-explain reasons, the current release of PICLAB does not allow
  184.     the use of a device name such as PRN in the PRINTFILE variable.  Images
  185.     must therefore be printed to disk and copied to the printer with DOS.
  186.  
  187. RUN
  188.  
  189.     This command takes one argument, which is taken as the name of a text file
  190.     containing PICLAB commands.  These are interpreted as if they had been
  191.     typed from the command line, but they are not echoed, and messages are
  192.     turned off while a program runs.  If a second argument to the RUN command
  193.     is the word ECHO, messages are not turned off.
  194.  
  195.     A program can also be run by giving its name as an argument to the PL
  196.     command when starting PICLAB.
  197.  
  198. SHOW
  199.  
  200.     The show command is used to display as much of the image in the NEW
  201.     buffer as will fit on the computer's display screen.  You can select
  202.     what kind of display you want with the "SET DISPLAY" command.
  203.  
  204.     If arguments are given, the first is used as a horizontal offset into the
  205.     image buffer and the second as a vertical offset.  This can be used to
  206.     look at different parts of an image too big for the screen.
  207.  
  208.     If no arguments are given, the current values of the XORIGIN and YORIGIN
  209.     variables are used as offsets.
  210.  
  211.     If any point transformations are pending, the image you see on screen
  212.     reflects the image as it would be AFTER the pending transformation.  This
  213.     can be used to look at the effect of a transformation before saving or
  214.     cancelling it.
  215.  
  216.     Because PICLAB currently does not support any devices that can display
  217.     images as accurately as PICLAB stores them, you can never really "see"
  218.     an image exactly as it is stored, only an approximation.
  219.  
  220. SET
  221.  
  222.     Without any arguments, this command lists all PICLAB variables and their
  223.     current values.  Variables can be numbers, character strings, or TRUE/
  224.     FALSE.  Variables control the specifics of how many commands perform and
  225.     set system defaults.
  226.  
  227.     If the set command is given one argument, the variable named is cleared.
  228.     That is, set to 0 if it is numeric, to "" if it is a string, and to FALSE
  229.     if it is TRUE/FALSE.
  230.  
  231.     If SET is given with two arguments, the variable named by the first is
  232.     set to the value specified by the second.  If a numeric variable is
  233.     given a string value, it is set to 0.  String values should not be put in
  234.     quotes.  TRUE/FALSE values may be set by the keywords TRUE/FALSE, YES/NO,
  235.     ON/OFF, or by the numeric values 1/0.
  236.  
  237.     As of this writing, here are the variables and their uses:
  238.  
  239.     Variables
  240.  
  241.     XORIGIN         Used to set the upper left limit of an image for
  242.     YORIGIN         operations such as CLIP and SHOW.  Legal values are
  243.                     0..(size of image - 1).  If image in NEW buffer is stored
  244.                     with bottom-up raster, YORIGIN is measured from the lower
  245.                     left counting upwards.
  246.  
  247.     PALETTE         Number of colors in palette for saving to limited-
  248.                     color file formats like GIF and PCX.  Legal values are
  249.                     2..256.  If the value is 16, PICLAB assumes you intend
  250.                     the image for an IBM EGA and behaves appropriately.
  251.  
  252.     CREZ            Color resolution or "depth" for GIF saving.  This value
  253.                     indicates the size of the palette from which an image
  254.                     was digitized.  Legal values are 1..8.
  255.  
  256.     DPI             Graphics resolution for LaserJet printing.  May be 75,
  257.                     150, or 300.
  258.  
  259.     MULTIIMAGE      T/F flag for GIF loading.  If true, PICLAB will assume
  260.                     that any GIF files to be loaded may contain multiple
  261.                     images and will act accordingly.  This requires more
  262.                     memory, so it defaults to FALSE.
  263.  
  264.     MULTIMAP        T/F flag for GIF loading.  If true, PICLAB will assume
  265.                     than any GIF files to be loaded may contain multiple
  266.                     images, and further, that each image may contain a local
  267.                     color map that differs from the global map.  This takes
  268.                     three times the memory of MULTIIMAGE mode, so it should
  269.                     be used only when absolutely necessary.
  270.  
  271.     PRINTER         String variable indicating what type of printer the PRINT
  272.                     command should address.  For a list of legal values, type
  273.                     LIST PRINTERS.
  274.  
  275.     PRINTFILE       Disk file to which the PRINT command is directed.  This
  276.                     defaults to "PDAT" but may be changed if you want to go
  277.                     to a different disk, or if you need to print more than
  278.                     one file before exiting.  As of this writing, using the
  279.                     device name "PRN" does not work correctly on some versions
  280.                     of MSDOS, although "/DEV/PRN" usually does.
  281.  
  282.     TEMPDIR         Name of the drive and directory where PICLAB stores its
  283.                     temporary files (including the NEW and OLD edit buffers).
  284.                     This directory must have six bytes free for every pixel
  285.                     in an image with which you intend to work plus some
  286.                     overhead.  This defaults to the setting of the TMP
  287.                     environment variable.
  288.  
  289.     PICDIR          Directory in which picture files are stored.  If you use
  290.                     the DIR, LOAD, and SAVE commands without specifying a
  291.                     directory, they will look here.
  292.  
  293.     FILEFORMAT      Default file format for DIR, LOAD, and SAVE commands.
  294.                     To operate on most file formats it is necessary to set
  295.                     this variable appropriately.  GIF and TGA are special:
  296.                     separate commands (GDIR, TLOAD, etc) exist to load and
  297.                     save these formats regardless of current setting.  For
  298.                     legal values, type LIST FORMATS.
  299.  
  300.     DISPLAY         Current display adaptor and mode for the SHOW command.
  301.                     For legal values, type LIST DISPLAYS.
  302.  
  303.  
  304. Point processes
  305. ===============
  306.  
  307. These are processes that modify each point in an images based only on the
  308. value of that one point.  Most of these commands are performed by modifying a
  309. lookup table that is not applied to the image itself until the TRANSFORM
  310. command is issued.  If one of these commands is issued, a transformation is
  311. said to be 'pending' until it is saved.
  312.  
  313. HISTOGRAM
  314.  
  315.     If no arguments are given, this command plots histograms for all planes;
  316.     if one or more arguments are given, a histogram is plotted for each plane
  317.     specified as an argument.  The histograms plotted reflect the image as it
  318.     would be after any pending transformations, so you can look at the
  319.     results of many processes before saving or cancelling them.
  320.  
  321.     Each vertical bar of the histogram represents the total number of pixels
  322.     in the image with values in the range beginning with the value listed
  323.     below the histogram in hexadecimal.  Each bar covers a range of four
  324.     values and there are 64 bars.  The height of each bar is in logarithmic
  325.     proportion to the frequency of occurrence of values in the range it
  326.     represents.  The bars are automatically scaled so that the tallest one is
  327.     made 20 characters high.
  328.  
  329. NEGATE
  330.  
  331.     Arguments are handled as in HISTOGRAM.  This simply inverts each value in
  332.     the lookup table for the planes specified.  This can be used after digi-
  333.     tizing a negative or for special effects.
  334.  
  335. BRIGHTEN
  336. DARKEN
  337.  
  338.     These commands add or subtract a constant value from each point in the
  339.     planes specified.  If only one argument is given, all planes are
  340.     brightened by that amount.  Otherwise, arguments are interpreted in
  341.     order, and any arguments that specify planes determine which plane the
  342.     next numerical argument will affect.  For example, BRIGHTEN RED 10 BLUE
  343.     15 would add 10 to the values in the red plane and 15 to those in the
  344.     blue.  The DARKEN command just subtracts the constants rather than adding
  345.     them.  Any values that would be taken out of the 0..255 range by the
  346.     transform are clamped.
  347.  
  348.     Because this brightening is a linear operation, the image to be
  349.     brightened or darkened should be encoded with a gamma of 1.0.  That is,
  350.     there should be a linear relationship between values in the image and
  351.     intensities on the display.  If this is not the case, gamma correction
  352.     may be applied with the GAMMA command before adjusting brightness.
  353.  
  354. CONTRAST
  355.  
  356.     This stretches or squeezes the contrast of an image.  Arguments are
  357.     interpreted like those in BRIGHTEN.  If a given value is positive, the
  358.     image contrast is stretched so that values that were equal to the given
  359.     value become 0, and those that were equal to (255-value) become 255.  If
  360.     the given value is negative, the inverse operation is performed.  Because
  361.     contrast is always stretched equally around the midpoint of the range, it
  362.     is a good idea to brighten or darken an image as necessary to center its
  363.     histogram before performing a contrast stretch.
  364.  
  365.     Also, the contrast stretching formula operates on color values assuming a
  366.     linear relationship between these values and the intensities they
  367.     represent (as do the BRIGHTEN and DARKEN commands).  Therefore, if an
  368.     image has been scanned with a device with a gamma value not equal to 1.0,
  369.     the image should be gamma corrected before contrast stretching.
  370.  
  371. GAMMA
  372.  
  373.     When the voltage applied to the phosphors of a monitor is increased, the
  374.     amount of light emitted by the phosphor increases even more.  The exact
  375.     difference varies from one monitor to the next, but the brightness of the
  376.     phosphors generally increases about 2.8 times as fast.  To compensate for
  377.     this, most video cameras are set to compensate downward.  (Actually,
  378.     cameras compensate for a gamma of 2.2, so that the final image still has
  379.     a non-linearity of about 1.2.  This is done to compensate for the light
  380.     conditions under which TV is normally viewed).
  381.  
  382.     Images generated by a computer do not generally take this into account.
  383.     Color values are often assumed to be linear, i.e., a point of value 4 is
  384.     twice as bright as a point of value 2, and a point of value 8 is twice as
  385.     bright as a point of value 4.  Images captured from a video camera with
  386.     gamma adjustment should be corrected with a GAMMA 2.2 command before
  387.     applying linear mathematical functions to them (like dithering, or
  388.     brightness and contrast adjustment).  Computer-generated images to be
  389.     displayed on monitors with standard phosphors may be corrected with the
  390.     inverse operation, GAMMA .45 (.45 = 1 / 2.2).  As a convenience, the
  391.     minus sign may be used to indicate inverse transformation, i.e.,
  392.     GAMMA -2.2 does the same thing as GAMMA .45.  I know this will make you
  393.     mathematicians out there cringe, but it is convenient.
  394.  
  395.     The best way to understand this is to do it.  If you have some images
  396.     that look 'washed out' on output, try contrast stretching first, but
  397.     also try a GAMMA > 1.0.  If an image looks artificially 'intense', try a
  398.     GAMMA < 1.0.
  399.  
  400. COLOR
  401.  
  402.     This just copies the gray plane of an image into separate red, green, and
  403.     blue planes.  These planes may then be operated upon separately as if the
  404.     image had been scanned in color.  If first argument is SLICE, then the
  405.     image is pseudo-colored by assigning a different hue to each range of
  406.     intensities in the order blue, cyan, green, yellow, red, magenta, and
  407.     white (light gray).
  408.  
  409. GRAY
  410.  
  411.     The inverse of the COLOR command, this takes a color image and maps it to
  412.     shades of gray.  The formula used for conversion to grayscale is the same
  413.     as used by black and white televisions and is designed to mimic the eye's
  414.     response: gray = (.287 * red) + (.589 * green) + (.114 * blue).
  415.  
  416. TRANSFORM
  417.  
  418.     This command actually saves the result of a series of point-process
  419.     transformations to the edit buffer.  This must be done before any other
  420.     transformation may be performed on the image.  If you wish to cancel the
  421.     pending transformations without saving them, use UNDO or CANCEL.
  422.  
  423.  
  424. Area processes
  425. ==============
  426.  
  427. These processes alter the value of a point based on its value and those of
  428. its immediate neighbors.  The exact neighborhood used depends on the command
  429. but is usually the 3x3 region with the source point in the center.  Unlike
  430. the point processes, these transforms take place immediately.
  431.  
  432. MEDIAN
  433.  
  434.     This is used to reduce spot noise from an image.  Each point is replaced
  435.     by the median of the points in its 3x3 area.  That is, the 9 points in
  436.     this area are sorted and the 5th one is taken.  If the one argument to
  437.     this routine is WEIGHTED, then the center point is added twice more to
  438.     the list and the 6th of the 11 points is taken.
  439.  
  440.     The median filter results in some smoothing, but not as much as with the
  441.     SMOOTH command.  This effect is a little less drastic with the weighted
  442.     median filter.
  443.  
  444.     This filter will not help reduce periodic or other noise--only small spot
  445.     noise such as from dust on a lens.
  446.  
  447. SHARPEN
  448.  
  449.     This applies what is called (somewhat inaccurately) a LaPlace transform
  450.     to the image.  The effect is that edges in the image are sharpened as if
  451.     the image had been re-focused.  Unfortunately, it also increases the
  452.     amount of noise in the image.
  453.  
  454.     The command can be given a single numerical argument, which specifies the
  455.     severity of the transform.  It is basically a tradeoff between sharpness
  456.     and noise, and defaults to 1.0.  This value provides a noticeable
  457.     increase in both sharpness and noise, and is about the best value for
  458.     sharpening when the purpose is to bring out information.  When applying
  459.     to a real image, a less severe value of .2 to .5 is often better.  Values
  460.     greater than 1.0 should be used only when trying to locate specific
  461.     objects in an image.  They produce too much noise for accurate
  462.     reproduction.
  463.  
  464.     This function works by amplifying the differences between each point and
  465.     its neighbors.  This has the effect of amplifying high spatial frequency
  466.     details such as edges and noise.
  467.  
  468. SMOOTH
  469.  
  470.     This function replaces each point with the average of the values of the 9
  471.     points in its neighborhood.  This has the effect of smoothing the image
  472.     and reducing high frequency effects like aliasing and noise, as well as
  473.     high frequency details.  If an argument is given, it is taken as a value
  474.     of the severity of the transform as with the SHARPEN command.  A value of
  475.     1.0 is exactly as described.  Values less than 1.0 change the center
  476.     value less than if a straight average had been done.  Values greater than
  477.     1.0 are not recommended.  If more smoothing is desired, perform SMOOTH
  478.     more than once rather than with a high value.
  479.  
  480.  
  481. Frame processes
  482. ===============
  483.  
  484. These processes operate on all of an image buffer or even both buffers.  Many
  485. of these processes require large amounts of memory and all are performed
  486. immediately.
  487.  
  488. The first three commands, ADD, SUBTRACT, and AVERAGE, operate on both the OLD
  489. and NEW buffers simultaneously.  To perform these operations on two files
  490. stored on disk, LOAD the first file, then LOAD the second file, which will
  491. move the first one to OLD, then perform the operation.  UNDO after one of
  492. these operations will leave the NEW buffer containing the image FIRST loaded.
  493. You must therefore load the second image again before repeating the command.
  494.  
  495. ADD
  496. SUBTRACT
  497.  
  498.     The ADD command adds the OLD and NEW edit buffers storing the result in
  499.     the NEW buffer.  If the only argument to the command is WRAP, then values
  500.     that are taken out of the 0..255 range by the addition are taken mod
  501.     255; otherwise, values are clamped.  SUBTRACT, as you would expect,
  502.     subtracts the NEW buffer from the OLD, storing the result in NEW.  No
  503.     arguments.
  504.  
  505. AVERAGE
  506.  
  507.     This command averages the OLD and NEW buffers, storing the result in NEW.
  508.     This can be used to reduce random digitizer noise by averaging the results
  509.     of different samplings.  Can also be used to produce a double-exposure
  510.     effect when two different images are averaged.  No arguments.
  511.  
  512. CLIP
  513.  
  514.     If no arguments are given, image is clipped from (XORIGIN,YORIGIN) to
  515.     lower right corner (upper right for bottom-up images).  If two arguments
  516.     are given, the image is clipped from (XORIGIN,YORIGIN) to the horizontal
  517.     and vertical size specified by the arguments.  XORIGIN and YORIGIN are set
  518.     to 0 after this operation.  One argument is an error--more than two are
  519.     ignored.
  520.  
  521. EXPAND
  522.  
  523.     This command increases the size of the image to the width and height
  524.     specified by its two arguments by adding extra rows and columns of
  525.     pixels.  If a third argument is given, it can be either BLACK or WHITE
  526.     to indicate what color the extra pixels should be.  Multiple images can
  527.     be placed in a montage by using EXPAND and OVERLAY.  Parts of an image
  528.     may be joined with these functions as well, but it is not recommended
  529.     for separately digitized image pieces, as no mosaicking (spelled right,
  530.     honest) is performed.
  531.  
  532. MIRROR
  533.  
  534.     Flips the image horizontally.  No Arguments.
  535.  
  536. OVERLAY
  537.  
  538.     Overlays the image in the NEW buffer on top of the OLD buffer.  The
  539.     image in the NEW buffer must not be larger than the image it is to
  540.     overlay.  If two arguments are given, they are used as the horizontal
  541.     and vertical offsets into the base image at which the overlay image
  542.     is to be placed.  Otherwise, XORIGIN and YORIGIN are used.
  543.  
  544. RESCALE
  545.  
  546.     This resamples the image at a different resolution.  This is useful for
  547.     scaling images up to a larger size for printing, or for scaling them down
  548.     for display.  It is recommended that image data always be saved at its
  549.     original sampling resolution to preserve as much data as possible and
  550.     only scaled when necessary to conform to hardware.
  551.  
  552.     If only one argument is given, horizontal and vertical resolution are
  553.     both increased in the given proportion.  For example, if a 320 x 240
  554.     image is in the NEW buffer when the command RESCALE 1.5 is given, the NEW
  555.     buffer will contain the same image at 480 x 360.
  556.  
  557.     More useful, though, is the case where two arguments are present.  In
  558.     this case, the arguments are treated directly as the new horizontal and
  559.     vertical resolution of the image.  The transformation above could be
  560.     expressed as RESCALE 360 480.  This is most often used to compensate for
  561.     differing aspect ratios.  For example, a 320 x 400 from an Amiga can be
  562.     rescaled to 320 x 200 to be viewed on a VGA, or to 720 x 540 for printing
  563.     on the HP PaintJet.
  564.  
  565. REVERSE
  566.  
  567.     Images are stored in either top-down or bottom-up directions.  Most of
  568.     the image processing techniques do not care which, so it is usually the
  569.     file format used to import the image that determines how it is stored.
  570.  
  571.     This command changes the storage order of an image from top-down to
  572.     bottom-up or vice versa.  This is used primarily to save an image loaded
  573.     from a file in one format (like PCX) to a format requiring the opposite
  574.     order (like GIF).
  575.  
  576.     TGA files can be stored either way, and contain information in the header
  577.     specifying which way they are stored.  Thus, any image can be saved in
  578.     TGA format at any time with minimal memory usage.
  579.  
  580. ROTATE
  581.  
  582.     This is used to rotate an image in 90-degree increments.  The single
  583.     argument may specify 1, 2, or 3, in which case that number of clockwise
  584.     90-degree rotations are performed.  If a number >= 90 is given as the
  585.     argument, the image is rotated that number of degrees (truncated to the
  586.     nearest 90-degree increment).
  587.  
  588.     This is very useful for rotating screen-oriented images for printing on
  589.     paper.  Because this operation requires large amounts of memory for large
  590.     images, it is recommended in this case to rotate the image before scaling
  591.     it up to size for printing.
  592.  
  593.  
  594. File I/O commands
  595. =================
  596.  
  597. DIR
  598.  
  599.     List all files in the PICDIR directory in the current file format.  If an
  600.     argument is given, files in that directory are listed.  No other file
  601.     specifications can be given.
  602.  
  603. GDIR
  604. TDIR
  605.  
  606.     As with DIR, files from PICDIR or from the directory given as the sole
  607.     argument are listed.  The GDIR command always lists GIF format files
  608.     while the TDIR command always lists Targa format files regardless of the
  609.     current setting of FILEFORMAT.
  610.  
  611. LOAD
  612.  
  613.     Loads a file in the current file format into the NEW buffer, moving the
  614.     current contents of the NEW buffer to OLD.  Any arguments are passed
  615.     along to the function that handles loading for the current format and
  616.     are interpreted by that routine.  The first argument is always the file
  617.     to be loaded, but other arguments vary with the format.  Below is a list
  618.     of arguments interpreted by the various file formats:
  619.  
  620.     TARGA       No arguments are interpreted.  Targa files are completely
  621.                 self descriptive and need no extra directions for loading.
  622.  
  623.     GIF         No arguments are interpreted from the command line, but
  624.                 GIF loading is affected by the values of the variables
  625.                 MULTIIMAGE and MULTIMAP.  These are both set false by
  626.                 default to save memory, but one or both may be necessary to
  627.                 load some files.  LOAD will issue warnings when loading a
  628.                 multiimage or multimap file with improper settings.
  629.  
  630.     RIX         Only uncompressed 256-color file formats from ColoRix are
  631.                 supported--the old EGAPaint files are not.  Because so many
  632.                 different file extensions are used, file extension must be
  633.                 specified when loading.  The global palette is taken from the
  634.                 image file regardless of the file extension, unlike ColoRix.
  635.  
  636.     IP          This is the Amiga DigiView's raw storage format.  It consists
  637.                 of nothing but three planes of data, one byte per pixel,
  638.                 followed by 12 bytes not associated with the image.  Because
  639.                 there is no size information in a IP file, the width and
  640.                 height of the image must be specified as the second and third
  641.                 arguments to LOAD.  A fourth argument may be the words COLOR
  642.                 or MONO to specify the number of planes.  COLOR is default.
  643.  
  644.     RAW         Raw files are even simpler than IP.  One file per plane,
  645.                 one byte per pixel, nothing else.  Arguments must be the same
  646.                 as those for IP format.  The file for plane one must have a
  647.                 .R8 extension, and the second and third planes, if any, must
  648.                 have .G8 and .B8.
  649.  
  650. GLOAD
  651. TLOAD
  652.  
  653.     Load image in GIF (GLOAD) or Targa (TLOAD) format regardless of the
  654.     current setting of FILEFORMAT.  No arguments to either function.
  655.  
  656. SAVE
  657.  
  658.     Saves the image in the NEW buffer to the file specified by the first
  659.     argument.  Subsequent arguments are passed along to the file save routine
  660.     of the current file format, and are interpreted as follows:
  661.  
  662.     TARGA       If one of the arguments is the number 16, 24, or 32, it is
  663.                 used as the number of bits per pixel stored in the file.
  664.  
  665.     GIF         If the word INTERLACE is given as an argument, the file is
  666.                 stored in GIF interlaced format.  A GIF file is always saved
  667.                 as a single-image file with the screen size and image size
  668.                 identical.  Because color GIF files are limited to a palette
  669.                 of 256 colors, color images will be dithered on output to a
  670.                 GIF file, and will therefore lose information.  Monochrome
  671.                 images are stored at full 256-shade resolution.
  672.  
  673.                 It can take several minutes to determine the best color
  674.                 palette, so be patient.
  675.  
  676.     RIX         Saving of images in these formats is not supported.  They may
  677.     IP          only be loaded and saved in Targa or GIF format.
  678.     RAW
  679.  
  680. GSAVE
  681. TSAVE
  682.  
  683.     These save the NEW buffer to the file named by the first argument in GIF
  684.     (GSAVE) or Targa (TSAVE) format regardless of the current setting of
  685.     FILEFORMAT.  See above for appropriate arguments.
  686.  
  687.  
  688. Warnings and Errors
  689. ===================
  690.  
  691. "Command arguments ignored"
  692.  
  693.     This warning occurs when you give a command more arguments than it needs.
  694.     Review the syntax of the command for an explanation.
  695.  
  696. "Open files were closed"
  697.  
  698.     This indicates that a command halted for some reason while files were open.
  699.     PICLAB has closed the files but data may be lost.
  700.  
  701. "Probable information loss"
  702.  
  703.     This warning is very common and should be taken lightly.  It indicates that
  704.     some transformation has been performed that is not reversible.  Most of
  705.     the time, the initial image will be safely stored in a disk file, or
  706.     recoverable with UNDO, so this is unimportant.
  707.  
  708. "Assertion failure; contact author"
  709.  
  710.     The is printed only in places I think are unreachable.  This message
  711.     indicates a serious error, and action (such as saving the working file
  712.     and exiting the program) should be taken immediately.
  713.  
  714. "Insufficient memory"
  715.  
  716.     There is not enough memory to perform the command issued with the current
  717.     environment.  This is most common in frame processes like ROTATE,
  718.     and with GIF loading with MULTIIMAGE and MULTIMAP set ON.  In the
  719.     latter case, those variables can be set to OFF before loading.  In the
  720.     former, there is not much alternative but to clip the image to a smaller
  721.     size or try to provide more memory.
  722.  
  723. "Miscellaneous file I/O"
  724.  
  725.     File open or write failed.  Could be bad or full disk.  Retrying may help.
  726.  
  727. "Unexpected end of file"
  728.  
  729.     File read failed.  This may occur when loading a file that is not encoded
  730.     in the correct format, or when loading a RAW or IP file when the size is
  731.     specified incorrectly.  CLIP may sometimes be used to recover.
  732.  
  733. "LZW compression/decompression"
  734.  
  735.     Usually the result of a bad GIF file.
  736.  
  737. "Unrecognized file format or bad file"
  738.  
  739.     The LOAD command encountered something in the file not consistent with the
  740.     file format being loaded.  Usually this is because you specified the wrong
  741.     format, but may also occur on a bad or incorrectly encoded file.
  742.  
  743. "Image buffer empty"
  744.  
  745.     You attempted a transformation when no image is in the edit buffers.
  746.  
  747. "Point transform pending; issue TRANSFORM command"
  748.  
  749.     The command you issued cannot be performed until any pending point trans-
  750.     formations are either saved with the TRANSFORM command or cancelled with
  751.     the UNDO command.
  752.  
  753. "Illegal parameter values"
  754.  
  755.     This is a catch-all command syntax error.  Review the syntax of the command
  756.     you are issuing.
  757.  
  758. "File not found"
  759.  
  760.     File open in LOAD command failed.  Check that the file is in the proper
  761.     directory by issuing a DIR command.  Also check for correct spelling.
  762.  
  763.  
  764. Technical Stuff
  765. ===============
  766.  
  767. The buffers NEW and OLD are stored in the disk files PLTEMP1.* and PLTEMP2.*
  768. on the drive and directory specified by the TEMPDIR variable.  Which file is
  769. which is basically random--they are switched by most commands, but not by
  770. all.  They are in raw 8 bits per pixel, one file per plane.  For color
  771. images, that means there are 3 files with file extensions of R8, G8, and B8.
  772. For monochrome images there is only an R8 file.
  773.  
  774. All image processing operations are performed to 8-bit unsigned precision.
  775. File formats that have limited palettes like GIF may be loaded without loss of
  776. information, but saving an image to these file formats will require that
  777. PICLAB dither, even if no changes were made between loading and saving.
  778.  
  779.  
  780. Acknowledgements
  781. ================
  782.  
  783. Many people have helped me bring this project together--some with helpful
  784. hints or advice, others with direct help, and others by the no less helpful
  785. device of inspiration.  While I cannot remember all of them, a few deserve
  786. mention (in no particular order):
  787.  
  788. Dale Brunken, my employer, who looked the other way when the insurance
  789. company's laser printers generated something besides actuarial tables.
  790.  
  791. Hewlett Packard technical support staff, who provided all the information I
  792. needed to generate good results on their printers.
  793.  
  794. John Bridges, whose IMGTOOLS package served both as inspiration and as a
  795. yardstick to measure the performance of my routines.  He still has me beaten,
  796. but I am working.  If the performance of PICLAB is a problem for you, his
  797. package is certainly a good investment.  His conversion of Targa files to
  798. GIF format is also superior to mine.
  799.  
  800. Bob Currier, who sent me a tape full of sample images to play with.  They
  801. were very useful in tuning the image processing code.
  802.  
  803. Jim Maxey, who probably uses PICLAB more than anyone else, for nagging me
  804. into fixing problems and sending me some of his wonderful pictures.
  805.  
  806. Phil Shatz, another PICLAB user, for suggestions and publicity.
  807.  
  808. And finally, and perhaps most importantly, the many other developers on the
  809. PICS forum of CompuServe.
  810.  
  811.  
  812. Legal Stuff
  813. ===========
  814.  
  815. Below are listed the owners of various trademarks that are either mentioned
  816. in this document or are likely to be mentioned in it in the future:
  817.  
  818. 'DigiView' is a trademark of NewTek Incorporated.
  819.  
  820. 'GIF' and 'Graphics Interchange Format' are trademarks of CompuServe
  821. Incorporated, an H&R Block company.
  822.  
  823. 'PaintJet' and 'LaserJet' are trademarks of Hewlett Packard Corporation.
  824.  
  825.  
  826. Author
  827. ======
  828.  
  829. Lee Daniel Crocker
  830. 1380 Jewett Ave
  831. Pittsburg, CA  94565
  832.  
  833. Best way to reach me: Type GO PICS on CompuServe and leave mail to user ID 
  834. [73407,2030].  I read these messages two or three times a week.
  835.  
  836. I am also reachable on BIX as "lcrocker", but I do not visit there as often.
  837.  
  838. June 23, 1989
  839.